home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / computerjanitor / file_cruft.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  2.3 KB  |  51 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import os
  5. import computerjanitor
  6. _ = computerjanitor.setup_gettext()
  7.  
  8. class FileCruft(computerjanitor.Cruft):
  9.     '''Cruft that is individual files.
  10.     
  11.     This type of cruft consists of individual files that should be
  12.     removed. Various plugins may decide that various files are cruft;
  13.     they can all use objects of FileCruft type to mark such files,
  14.     regardless of the reason the files are considered cruft.
  15.     
  16.     When FileCruft instantiated, the file is identified by a pathname.
  17.     
  18.     '''
  19.     
  20.     def __init__(self, pathname, description):
  21.         self.pathname = pathname
  22.         st = os.stat(pathname)
  23.         self.disk_usage = st.st_blocks * 512
  24.         self.description = description
  25.  
  26.     
  27.     def get_prefix(self):
  28.         return 'file'
  29.  
  30.     
  31.     def get_prefix_description(self):
  32.         return _('A file on disk')
  33.  
  34.     
  35.     def get_shortname(self):
  36.         return self.pathname
  37.  
  38.     
  39.     def get_description(self):
  40.         return '%s\n' % self.description
  41.  
  42.     
  43.     def get_disk_usage(self):
  44.         return self.disk_usage
  45.  
  46.     
  47.     def cleanup(self):
  48.         os.remove(self.pathname)
  49.  
  50.  
  51.